HTMLModelElement: stagemode property
The HTMLModelElement.stageMode
property reflects the stagemode
HTML attribute, which indicates the current stage mode for the model element.
Value
stageMode can be set to the following values:
-
none
: Take no action; equivalent to the value not being set. -
orbit
: Enter Orbit mode, interpret horizontal user gestures as a rotation of the vertical axis and vertical gestures as rotation in the local pitch plane.
Orbit mode
While the specific behavior of an orbit mode may vary between user agents, it has the following characteristics:
-
The
entityTransform
becomes read-only, and reflects a scale and translation that fully accommodates the model contents within the visible bounding box of the model's viewport. -
Pointer events on the model's viewport reflect a pivoting behavior, similar to an "Orbit camera" as provided in may computer graphics applications.
Impact on entityTransform
Setting the stagemode
to orbit
immediately has these consequences for the model element's entityTransform
:
-
Transform is
orbit-fit
: The scale and position reflected by the model'sentityTransform
is forced to be centered on itsboundingBoxCenter
and to accommodate the full size of the model'sboundingBoxExtents
. This differs to - and is likely smaller than - the model's default, object fit transformation. -
Transform is read-only: While
entityTransform
is set to a read-only mode where any programmatic attempt to set it directly is ignored, throwing an error. -
Transform remains updated: Updates to the effective transform are reflected in the parameter, so that information related the model's current orientation can be used to drive other aspects of the page's behavior.
Examples
This example demonstrates how to set a model's stage mode to orbit.
<model stagemode="orbit">
<source src="teapot.usdz" type="model/vnd.usdz+zip" />
</model>
Specifications
No specification found
No specification data found for api.HTMLModelElement.stageMode
.
Check for problems with this page or contribute a missing spec_url
to mdn/browser-compat-data. Also make sure the specification is included in w3c/browser-specs.